<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.min.js"></script>
</head>
<body>
  <div>
      <span>username</span><input type="text" name="username" id="username"/>
      <span>sex</span><input type="password" name="pass" id="password"/>
      <input type="hidden" id="pwd" name="password">
      <button type="submit" onclick="aaa()">submit</button>
  </div>
<script type="text/javascript">
   function aaa() {
       var username=document.getElementById('username');
       var password=document.getElementById('pwd');
       password.value=md5(pass.value);
   }
</script>
</body>
</html>